<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="layout" content="bocMain"/>
    <title>进件作业系统</title>
</head>

<body>
<header class="header-title">授信额度列表</header>


<div class="weui-cells weui-cells_checkbox">
    <g:if test="${fields}">
        <g:form method="post" action="successfulListSave" class="myform">
            <div class="weui-cells__title" style="color: #999">请选择授信方案（单选）</div>
            <input type="hidden" name="id" id="id" value="${this?.opportunity?.id}">
            <g:each in="${fields}">
                <div class="radioList">
                    <div class="weui-cell weui-check__label" for="s11" style="align-items:stretch">
                        <div class="weui-cell__hd">
                            <label class="weui-label" style="width:30px">
                                <g:radio class="weui-check" name="checkbox1" id="checkbox1" value="${it.name}"/>
                                <i class="weui-icon-checked"></i>
                            </label>

                        </div>

                        <div class="weui-cell__bd">
                            <p class="title">${it.name}</p>
                        </div>
                    </div>
                    <div class="weui-cell base-mate weui-label-10">
                        <div class="weui-cell__hd"><label class="weui-label total">¥${it.value}</label></div>

                        <div class="weui-cell__bd rate">
                            总费率：${it.defaultValue ? it.defaultValue?.toDouble() * 100 : 0}%/${opportunity?.loanDuration}期
                        </div>
                    </div>

                    <div class="weui-cell base-mate weui-label-10">
                        <div class="weui-cell__hd"><label class="weui-label">基础材料要求：</label></div>

                        <div class="weui-cell__bd">
                            <g:each var="field" in="${com.next.OpportunityFlexFieldValue.findAllByField(it)}">
                                <p>${field.value}</p>
                            </g:each>
                        </div>
                    </div>
                </div>
            </g:each>
        </g:form>
        <div class="bigBtn weui-flex">
            <button type="button" class="weui-btn weui-btn_primary" id="downMe"
                    style="margin-top: 15px;margin-right: 10px;">拒绝</button>
            <button type="button" class="weui-btn weui-btn_primary" id="submit">下一步</button>
        </div>
    </g:if>
    <g:else>
        <div class="photoFrame">
            <div class="photo-item">
                <i class="weui-icon-cancel weui-icon_msg icon-info"></i>
                <h5 style="margin-top: 1rem">抱歉，您暂不符合我行评分准入条件</h5>
            </div>
        </div>

        <div class="bigBtn">
            <a href="/bocAppOpportunity/businessManagement" class="weui-btn weui-btn_primary">订单列表</a>
        </div>
    </g:else>
</div>

<script>

    $(function () {
        function helpMessage(message) {
            $(".helpMsg").text(message).fadeIn(200);
            setTimeout(function () {
                $(".helpMsg").fadeOut(200);
            }, 2000);
        }

        $("#submit").click(function () {
            var checkbox1 = $("input[type='radio']").is(':checked');
            if (!checkbox1) {
                helpMessage("请选择授信方案");
                return;
            }
            $(".myform").submit();
        })


    })

</script>

</body>
</html>
